/**
IGroupservice.java * 实现groupservice接口 ，
 */
package com.emode.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.emode.base.BaseDaoImpl;
import com.emode.base.Pager;
import com.emode.entity.SysGroup;
import com.emode.service.GroupService;

/**
 * @author emode
 *
 * 2014年12月26日 下午11:09:05

 */
public class GroupServiceImpl extends BaseDaoImpl<SysGroup> implements GroupService {

	public List<SysGroup> getGroupByPage(SysGroup group,Pager p) {
		
		StringBuffer whereHql = new StringBuffer();
		List<String> paramsList = new ArrayList<String>();
		Object[] values = paramsList.toArray();
		if(!StringUtils.isBlank(group.getGroupName())){
			whereHql.append(" and o.groupName like ?");
			paramsList.add("%"+group.getGroupName()+"%");
		}else if(!StringUtils.isBlank(group.getDescription())){
			whereHql.append(" and o.description like ?");
			paramsList.add("%"+group.getDescription()+"%");
		}
		//Integer count = getCount(whereHql.toString(), values);
		//p.init(count);
		return findObjectByConditionWithPage(whereHql.toString(), values, null, p);
	}
}
